package com.chen.bpsptsystem.controller;


import com.chen.bpsptsystem.common.ServerResponse;
import com.chen.bpsptsystem.po.User;
import com.chen.bpsptsystem.service.IUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author chen
 */
@RestController
@RequestMapping("/front/")
public class LoginController {

    @Resource
    private IUserService userService;

    /**
     * 注册
     *
     * @param user
     * @param inteId 兴趣id 1,2,3...
     * @return
     */
    @PostMapping("register")
    public ServerResponse register(@RequestBody User user, String inteId) {
        return userService.register(user, inteId);
    }

    /**
     * 登录
     *
     * @param amount
     * @param password
     * @return
     */
    @PostMapping("login")
    public ServerResponse login(String amount, String password) {
        return userService.login(amount, password);
    }

    /**
     * 我的用户信息
     *
     * @param userId
     * @return
     */
    @PostMapping("userInfo")
    public ServerResponse userInfo(Integer userId) {
        return userService.userInfo(userId);
    }

}
